﻿using System;
using K9Nano.Authorization;
using K9Nano.RemoteClient;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace K9Admin.Remoting
{
    public static class AdminClientStartupExtensions
    {
        public static void AddAdminClient(this IServiceCollection services, Action<RemoteClientOptions> configureOptions)
        {
            services.AddRemoteClient<UserService.UserServiceClient>(configureOptions);
            services.AddRemoteClient<OrganizationService.OrganizationServiceClient>(configureOptions);
            services.AddRemoteClient<TenantService.TenantServiceClient>(configureOptions);
            services.AddRemoteClient<ApiResourceService.ApiResourceServiceClient>(configureOptions);
            services.Replace(ServiceDescriptor.Singleton<IRoleResourceStore, RemoteRoleResourceStore>());
        }
    }
}